;$%@0 (+-*/)
	$;
.TRIM @10%
^IND@76 ^TRIM@86%
.STM @81%
%
 $;
	@10%
% ------ CHANGE SPACE TO TAB
	$;
 @10%
%
		$;
 @10%
%
			$;
 @10%
%
.STM BYTE $;
.@10:	DS	1@F1%
%
.STM BYTE $($);
.@10:	DS	@24@F1%
%
.STM INT I$;
.I@10:	DW	0@F1%
%
.STM INT I$($);
.I@10:	DS	@24*2@F1%
%
.STM GOSUB $;
	CALL	..@10@F1%
%
.STM I$=I$;
	LHLD	.I@20@F1%
	SHLD	.I@10@F1%
%
.STM $=+000;
	XRA	A@F1%
	STA	.@10@F1%
%
.STM I$=+K$;
	LXI	H,.K@20@F1%
	SHLD	.I@10@F1%
%
.STM $=+K$;

	MVI	A,.K@20@F1%
	STA	.@10@F1%
%
.STM I$=+$;
	LXI	H,@24@F13%
	SHLD	.I@10@F13%
%
.STM I$=I$(I$);
	LXI	D,.I@20@F1%
	LHLD	.I@30@F1%
	DAD	H@F1%
	DAD	D@F1%
	XCHG@F1%
	LXI	H,.I@10@F1%
	LDAX	D@F1%
	MOV	M,A@F1%
	INX	D@F1%
	INX	H@F1%
	LDAX	D@F1%
	MOV	M,A@F1%
%
.STM I$=I$($);
	LXI	D,.I@20@F1%
	LDA	.@30@F1%
	ADD	A@F1%
	MOV	L,A@F1%
	MVI	H,0@F1%
	DAD	D@F1%
	XCHG@F1%
	LDAX	D@F1%
	MOV	L,A@F1%
	INX	D@F1%
	LDAX	D@F1%
	MOV	H,A@F1%
	SHLD	.I@10@F1%
%
.STM I$($)=I$;
	LXI	D,.I@10@F1%
	LDA	.@20@F1%
	ADD	A@F1%
	MOV	L,A@F1%
	MVI	H,0@F1%
	DAD	D@F1%
	XCHG@F1%
	LHLD	.I@30@F1%
	MOV	A,L@F1%
	STAX	D@F1%
	INX	D@F1%
	MOV	A,H@F1%
	STAX	D@F1%
%
.STM $(I$)=$;
	LHLD	.I@20@F1%
	LXI	D,.@10@F1%
	DAD	D@F1%
	LDA	.@30@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DEHL@F13%
	RAL@F13%
	ANI	1@F13%
	STA	.@10@F13%
%
.STM $=$<=$;
	LXI	H,.@30@F1%
	LDA	.@20@F1%
	CMP	M@F1%
	CALL	?SETAC@F1%
	STA	.@10@F1%
%
.STM $=$<!$;
	LDA	.@20@F1%
	LXI	H,.@30@F1%
	CMP	M@F1%
	RAL@F13%
	ANI	1@F13%
	STA	.@10@F1%
%
.STM $=!$;
	LDA	.@20@F13%
	CMA@F13%
	ANI	1@F13%
	STA	.@10@F13%
%
.STM ENDMAIN$;
	CALL	?ENDING@F1%
	JMP	?BOOT@F13%
%
.STM ON $;
	LDA	.@10@F13%
	ORA	A@F13%
.POP%
^CSI@96 	JZ	?BL0@91@F13%
.PUSH @91%
%
.STM I$--;
	LHLD	.I@10@F13%
	DCX	H@F13%
	SHLD	.I@10@F13%
%
.STM I$(I$)=I$;
	LXI	D,.I@10@F13%
	LHLD	.I@20@F13%
	DAD	H@F1%
	DAD	D@F13%
	XCHG@F13%
	LHLD	.I@30@F13%
	MOV	A,L@F13%
	STAX	D@F13
	INX	D@F13%
	MOV	A,H@F13%
	STAX	D@F13%
%
.STM $--;
	LXI	H,.@10@F13%
	DCR	M@F13%
%
.STM $($)=$;
	LDA	.@20@F13%
	MVI	H,0@F13%
	LXI	D,.@10@F13%
	MOV	L,A@F13%
	DAD	D@F13%
	LDA	.@30@F13%
	MOV	M,A@F13%
%
.STM $=$==$;
	LXI	H,.@20@F13%
	LDA	.@30@F13%
	CMP	M@F13%
	JZ	$+5@F1%
	XRA	A@F13%
	LXI	B,013EH@F1%
	STA	.@10@F13% ; SAVE RESULTANT
%
.STM $=I$!=I$;
	LXI	D,.I@30@F1%
	LXI	H,.I@20@F1%
	MVI	B,1@F1%
	LDAX	D@F1%
	XRA	M@F1%
	JNZ	$+10@F1%
	INX	H@F1%
	INX	D@F1%
	LDAX	D@F1%
	XRA	M@F1%
	JZ	$+4@F1%
	MOV	A,B@F1%
	STA	.@10@F1%
%
.STM $=$!=$;
	LXI	H,.@30@F13%
	LDA	.@20@F13%
	XRA	M@F13%
	JNZ	$+5@F1%
	XRA	A@F13%
	LXI	B,013EH@F1%
	STA	.@10@F13%
%
.STM $=I$==I$;
	LXI	B,.I@30@F13%
	LHLD	.I@20@F13%
	LDAX	B@F13%
	XRA	L@F13%
	JNZ	$+12@F1%
	INX	B@F13%
	LDAX	B@F13%
	XRA	H@F13%
	JNZ	$+6@F1%
	MVI	A,1@F13%
	LXI	B,003EH@F1%
	STA	.@10@F13%
%
.STM $='$';
	MVI	A,'@20'@F13%
	STA	.@10@F13%
%
.STM $=$+$;
	LXI	H,.@20@F1%
	LDA	.@30@F1%
	ADD	M@F1%
	STA	.@10@F1%
%
.STM $=$-$;
	LXI	H,.@30@F1%
	LDA	.@20@F1%
	SUB	M@F1%
	STA	.@10@F1%
%
.STM $=$&$;
	LXI	H,.@30@F1%
	LDA	.@20@F1%
	ANA	M@F1%
	STA	.@10@F1%
%
.STM $=$?$;
	LXI	H,.@30@F1%
	LDA	.@20@F1%
	ORA	M@F1%
	STA	.@10@F1%
%
.STM LOC $;
?LL0@10:%@F13%
%
.STM GOTO $;
	JMP	?LL0@10@F13%
%
.STM SUB $;
..@10:@F1%
%
.STM I$++;
	LHLD	.I@10@F1%
	INX	H@F1%
	SHLD	.I@10@F1%
%
.STM IF $;	IF STATEMENT
	LDA	.@10@F13%	; GENERATE LDA X
	ORA	A@F13%		; GENERATE SET FLAGS
.PUSH @01%
	JZ	?FI0@01@F13%	; GENERATE JZ	?FI0XX
% ----- END OF IF STATEMENT
.STM ELSE$;
.POP%
^CSI@96 .ELSE @91%
%
.ELSE$;
	JMP	?FI0@01@F13%
^CSI@96 ?FI0@91:@F13%
.PUSH @01%
%
.STM ENDIF$;
.POP%
^CSI@96 ?FI0@91:@F13%
%
.STM CHOOSE ON $;
	LDA	.@10@F13%
	STA	.ERASER.@F1%
.PUSH @01%	; ENDCHOOSE LABEL
.PUSH C%
% ------ END OF CHOOSE ON
.STM CASE $;	; CASE STATEMENT (UGH@)
.POP%	; POP INDICATOR OF PREVIOUS STATEMENT OFF STACK
^CSI@96 .IF @91=C SKIP 6%	; IF FIRST TIME THRU CASE
.POP%	; GET ENDCHOOSE OR DEFAULT LABEL
^CSI@96 	JMP	?XC0@91@F13%	; GENERATE JMP
.LET ^ELB=@91%	; SAVE LABEL FOR LATER
.POP%	; GET ADDRESS OF JUMP TO NEXT CASE OR DEFAULT
^CSI@96 ?CA0@91:	LDA	.@10@F13% ; GENERATE LD
.SKIP 3%	; JUMP ACROSS FIRST TIME CODE
	LDA	.@10@F13%	; GET PARAMETER OF CASE
.POP%	; GET LABEL OF ENDCHOOSE
^CSI@96 .LET ^ELB=@91% ; SAVE LABEL
.PUSH @02% ; SET UP LABEL FOR JNZ CASE N+1 OR DEFAULT
	LXI	H,.ERASER.@F1%
	CMP	M@F13%	; OUTPUT COMPARE
	JNZ	?CA0@02@F13% ; OUTPUT JUMP CASE N+1 OR DEFAULT
^ELB@96 .PUSH @91% ; PUT END LABEL BACK ON STACK
.PUSH S% 	; SAY NOT FIRST TIME THRU
%
.STM DEFAULT$;	; DEFAULT STATEMENT
.POP%	; POP INDICATOR OFF STACK (YOU WONT NEED IT NOW)
.POP%	; GET ENDCHOOSE LABEL FROM STACK
^CSI@96 .LET ^ELB=@91% ; SAVE ENDLABEL
	JMP	?XC0@91@F13%
.POP%	; GET THIS LABEL
^CSI@96 ?CA0@91:	; DEFAULT CLAUSE@F13%
^ELB@96 .PUSH @91%	; PUT ENDCHOOSE LABEL ON STACK
.PUSH D%
%
.STM ENDCHOOSE$; ; END OF MULTIPATH BRANCH
.POP%
^CSI@96 .LET ^ELB=@91% ; TYPE OF ENDING (D OR S)
.POP%
^CSI@96 ?XC0@91:@F13% ; OUTPUT ENDING OF CHOOSE ON
.IF ^ELB==D SKIP 3% ; SKIP OVER ENDING FOR NON-DEFAULT CASE
.POP%
^CSI@96 ?CA0@91:@F1%
; DEFAULT END@F1%
%
.STM $++;
	LXI	H,.@10@F1%
	INR	M@F1%
%
.STM ENDSUB$;
	RET@F1%
%
.STM PARAMETER K$=$;
.K@10	EQU	@24@F1%
%
.STM STOP $;
	MVI	A,@10@F13%
	CALL	?ISTOP@F1%
	EXTRN	?ISTOP@F1%
%
.STM RETURN;
	RET	@F13%
%
.STM OPEN $ FOR $ AT $;
	LXI	D,.@10@F13%
	LDA	.@20@F13%
	LHLD	.@30@F13%
	CALL	?IOPEN@F13%
	EXTRN	?IOPEN@F13%
%
.STM CLOSE $;
	LXI	H,.@10@F13%
	CALL	?BCLOF@F13%
	EXTRN	?BCLOF@F13%
%
.STM READ $ FROM $
	LXI	D,.@20@F13%
	LXI	H,.@10@F13%
	CALL	?BREAD@F13%
	EXTRN	?BREAD@F13%
%
.STM WRITE $ INTO $
	LXI	D,.@20@F13%
	LDA	.@10@F13%
	CALL	?BWRIT@F13%
	EXTRN	?BWRIT@F13%
%
.STM PACK (I$,$,$);
	LDA	.@30@F13%
	MOV	L,A@F13%
	LDA	.@20@F13%
	MOV	H,A@F13%
	SHLD	.I@10@F13%
%
.STM $=+$;
	MVI	A,@24@F1%
	STA	.@10@F1%
%
.STM BOTTOM;
	COMMON	/IOCTRL/@F13%
.ER:	DB	0@F13%
.AC:	DB	0@F1%
.IAV:	DS	12@F1%
	DSEG@F13%
	DS	40@F13%
?STACK:	DS	2@F13%
	END	START@F13%
%
.STM BEGINMAIN ($,$);
.ERASER.: DB	0
	CSEG@F13%
?SETAC:	MVI	A,1@F1%
	RM		; RETURN ON MINUS@F1%
	RZ		; RETURN ON ZERO (AC=1)@F1%
	XRA	A	; NON-ZERO NON-CARRY@F1%
	RET@F1%
START:	LXI	SP,?STACK@F13%
	CALL	?INIT@F1%
	LXI	B,.@10@F1%
	LXI	D,.@20@F1%
%
.STM FINIS$;
.. END OF PIDGIN COMPILATION@F15%
@F0%
%
.STM TOP$;
..PIDGIN FOR THE 8080 COPYRIGHT (C) A. L. BENDER, M. D.@F15%
	EXTRN	?INIT,?ENDING,?BOOT@F1%
	DB	'COPYRIGHT (C) 1981 A. L. BENDER, M. D.'@F1%
	DSEG@F13%
%
.STM UNPACK (I$,$,$);
	LHLD	.I@10@F13%
	MOV	A,L@F13%
	STA	.@30@F13%
	MOV	A,H@F13%
	STA	.@20@F13%
%
.STM CALL I$;
	LXI	H,$+8@F1%
	PUSH	H@F1%
	LHLD	.I@10@F1%
	PCHL@F1%
%
.STM ASSOCIATE FCB $ WITH $;
	LXI	D,?IFCB+((@10-1)*36)@F1%
	LXI	H,.@20@F1%
	CALL	?ATACH@F1%
	EXTRN	?ATACH,?IFCB@F1%
%
.STM READBUF $;
	LXI	D,.@10@F13%
	CALL	?RDBUF@F13%
	EXTRN	?RDBUF@F13%
%
.STM WRITEBUF $;
	LXI	D,.@10@F13%
	CALL	?WRBUF@F13%
	EXTRN	?WRBUF@F13%
%
.STM READ $;
	CALL	?RNX@F1%
	EXTRN	?RNX@F1%
	STA	.@10@F1%
%
.STM WRITE $;
	LDA	.@10@F1%
	CALL	?WRNXT@F1%
	EXTRN	?WRNXT@F1%
%
.STM WHILE$;
.PUSH @01%
?TL0@01:%@F13%
%
.STM ENDWHILE$;
.POP%
^CSI@96 @91@96%
^CSI@96 	JMP	?TL0@91@F13%
?BL0@91:@F13%
%
.PUSH $;
.LET ^CSP=^CSP+1%
^CSP@96 .STO ^CS@91=@10%
% - END OF PUSH
.POP;
^CSP@96 .IF @91<1 SKIP 3%
^CS@91@86 .STO ^CSI=@81%
.LET ^CSP=^CSP-1%
@F9%
.STO ^CSI=*%
@FE%
% - END OF POP
.STO $=$;
@F3%
% -END OF STORE
.LET $=$;
@24@26 @F3%
% -END OF LET
.SKIP $;
@F4%
% - END OF SKIP
.IF $=$ SKIP $;
@F50%
%
.IF $-=$ SKIP $;
@F51%
%
.IF $<$ SKIP $;
@F6-%
%
.IF $==$ SKIP $;
@F60%
%
.IF $<>$ SKIP $;
@F61%
%
.DUMP STACK;
^DBG@56 .IF @51=T SKIP 1%
@F9%
.LET ^CNT=^CSP%
^CSP@16 @11@F7%
^CNT@26 ^CS@21@36%
^CS@21	"@31"@F14%
.LET ^CNT=^CNT-1%
@F8%
^LEV@46%
^LEV	=@41@F14%
%
.DEBUG;
.STO ^DBG=T%
%
.UNBUG;
.STO ^DBG=F%
%
.IF $>$ SKIP $;
@F6+%
%
.CAT $,$;
@11@20@26  @F3%
% - END CONCATENATION
.TRIM  $;
.TRIM @10%
%
.TRIM	$;
.TRIM @10%
%
.TRIM $;
.STO ^TRIM=@10%
%
.XSTM $;
.INCLEV%
.TRIM @10%
^TRIM@26 .YSTM @21%
%
.YSTM %
%
.YSTM ;@%
%
.INCLEV;
.LET ^LEV=^LEV+1%
.CAT ^IND, | %
%
.DECLEV;
^LEV@16 .IF @11<1 SKIP 2%
.LET ^LEV=^LEV-1%
^IND@26 .UND @21%
% --------
.UND  $ | ;
.STO ^IND=@10%
% --------
.TOS;
^CSP@96 .IF @91<1 SKIP 2%
^CS@91@86 .STO ^CSI=@81%
@F9%
.STO ^CSI=*%
%
.CONSOLE;
5@F2%
%%
.LET ^ERR=0;
.LET ^IOS=0;
.LET ^LEV=0;
.STO ^IND=;
.LET ^CSP=0;
.STO ^DBG=F
.STO ^ELB=;
.LET ^WPL=0;
.STO ^CS0=*;
.STO ^SOP=;
.STO ^DOP=;
